package t10086.Model.Entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

import java.time.LocalDateTime;


@Entity
@Table(name ="`order`")
public class Order {

    @Id
    @Column(name = "order_number",nullable = false,columnDefinition = "varchar(255)")
    private String orderNumber;
    
    @Column(name = "patient",nullable = false,columnDefinition = "varchar(255)")
    private String patient;

    @Column(name = "patient_id",nullable = false,columnDefinition = "varchar(255)")
    private String patientId;

    @Column(name = "doctor",nullable = false,columnDefinition = "varchar(255)")
    private String doctor;

    @Column(name = "doctor_id",nullable = false,columnDefinition = "varchar(255)")
    private String doctorId;

    @Column(name = "medicine",nullable = false,columnDefinition = "TEXT")
    private String medicine;

    @Column(name = "date",nullable = false,columnDefinition = "datetime")
    private LocalDateTime date;

    @Column(name = "status",nullable = false,columnDefinition = "int")
    private int status;


    public Order() {}
    public Order(String orderNumber, String patient, String patientId, String doctor, String doctorId, String medicine) {
        this.orderNumber = orderNumber;
        this.patient = patient;
        this.patientId = patientId;
        this.doctor = doctor;
        this.doctorId = doctorId;
        this.medicine = medicine;
        this.date = LocalDateTime.now();
        this.status = 0;
    }
    public String getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(String orderNumber) {
        this.orderNumber = orderNumber;
    }

    public String getPatient() {
        return patient;
    }

    public void setPatient(String patient) {
        this.patient = patient;
    }

    public String getPatientId() {
        return patientId;
    }

    public void setPatientId(String patientId) {
        this.patientId = patientId;
    }

    public String getDoctor() {
        return doctor;
    }

    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }

    public String getDoctorId() {
        return doctorId;
    }

    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }

    public String getMedicine() {
        return medicine;
    }

    public void setMedicine(String medicine) {
        this.medicine = medicine;
    }

    public LocalDateTime getDate() {
        return date;
    }

    public void setDate(LocalDateTime date) {
        this.date = date;
    }
    public int getStatus() { return status; }
    public void setStatus(int status) { this.status = status; }

    @Override
    public String toString() {
        return "Prescription [orderNumber=" + orderNumber + ", patient=" + patient+ "," +
                " patientId=" + patientId + ", doctor=" + doctor+ ", doctorId=" + doctorId +
                ", medicine="+medicine+", date=" + date +", status="+status+ "]";
    }
}
